import Vue from 'vue';
import Router from  'vue-router';

import test from "../views/test";


//管理员页面
import login from "../views/admin/Login";
import adminIndex from "../views/admin/adminIndex";
import mangeUsers from "../views/admin/manageUsers";
import manageOrders from "../views/admin/manageOrders";
import manageProduct from "../views/admin/manageProduct";
import manageProductCatlog from "../views/admin/manageProductCatlog";
import ProductAdd from "../views/admin/FunctionPage/ProductAdd";
import UserUpdate from "../views/admin/FunctionPage/UserUpdate";
import ProductImage from "../views/admin/FunctionPage/ProductImage";
import CatlogAdd from "../views/admin/FunctionPage/CatlogAdd";
import ProductUpdate from "../views/admin/FunctionPage/ProductUpdate";
import OrderUpdate from "../views/admin/FunctionPage/OrderUpdate";
import CatlogUpdate from "../views/admin/FunctionPage/CatlogUpdate";
import index from '../views/index';
import loginLog from '../views/log/loginLog';
import Ulog from '../views/log/Ulog';
//404
import NotFound from "../views/NotFound";







Vue.use(Router);

export default  new Router({
  mode:'history',
  routes:[{
    path:'/Login',
    component:login
  },{
    path: '/test',
    component:test
  },{
    path:'*',
    component:NotFound
  },{
    path:'/adminIndex',
    component:adminIndex,
    meta:{requireAuth:true},
    children:[{
      path:'/admin/manageUsers',
      meta:{requireAuth:true},
      component:mangeUsers },
      {
        path:'/admin/manageOrders',
        meta:{requireAuth:true},
        component:manageOrders
      },
      { path:'/admin/manageProduct',
      meta:{requireAuth:true},
        component:manageProduct  
    },
      { 
        path:'/admin/manageProductCatlog',
        meta:{requireAuth:true},
        component:manageProductCatlog

    }
    ,{
      path:'/index',
      name:'index',
      component:index,
      meta:{requireAuth:true}
    },
    {
      path:'/log/loginLog',
      name:'loginLog',
      meta:{requireAuth:true},
      component:loginLog
    },
    {
      path:'/log/Ulog',
      name:'Ulog',
      meta:{requireAuth:true},
      component:Ulog
    }
      ]
  },{
      path:"",
      component:login
  },{
    path:"/admin/productAdd",
    name:'productAdd',
    meta:{requireAuth:true},
    component:ProductAdd
  },
  {
    //用名字当作路由地址
    path:"/admin/UserUpate",
    name:'userUpdate',
    meta:{requireAuth:true},
    component:UserUpdate
  },{
    path:"/admin/ProductImage",
    name:"productImage",
    meta:{requireAuth:true},
    component:ProductImage

  },{
    path:"/admin/CatlogAdd",
    name:'catlogAdd',
    meta:{requireAuth:true},
    component:CatlogAdd
  },{
    path:"/admin/productUpdate",
    name:"productUpdate",
    meta:{requireAuth:true},
    component:ProductUpdate
  },
  {
      path:"/admin/orderUpdate",
      name:'orderUpdate',
      meta:{requireAuth:true},
      component:OrderUpdate
  },
  {
    path:"/admin/CatlogUpdate",
    name:"catlogUpdate",
    meta:{requireAuth:true},
    component:CatlogUpdate
  },
 
  ]
})
